classdef MutualInformation < Algorithm & Metric
    %MUTUALINFORMATION Summary of this class goes here
    %   Detailed explanation goes here
    
    properties
    end
    
    methods
        function [ this ] = MutualInformation( name )
            if nargin == 0
                this.setName('mi');
            end
            if nargin >= 1
                this.setName(name);
            end
        end
    end
    
    methods
        function [ result ] = apply( this, X2, Y2 )
            result = mutualinfo(X2, Y2); % For binary class only
        end
    end
    
    methods ( Static = true )
        function [ z_result ] = calc( X, Y )
            % `X` must be a single vector
            % `Y` could be a label subset
            nLabel = size(Y, 2);
            z_result = zeros(1, nLabel);
            for iLabel = 1:nLabel
                z_result(iLabel) = mutualinfo(X, Y(:, iLabel));
            end
        end
    end
    
end

